home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3677 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: maverick.tad.eds.com!news-admin@tad.eds.com
  2. From: Erick Wagner <wagnere@netcom.com>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Source utilities for endian conversion
  5. Date: 30 Jan 1996 16:42:33 GMT
  6. Organization: PRC
  7. Message-ID: <4elhpp$925@maverick.tad.eds.com>
  8. References: <rt9sph42r1m.fsf@topo.nist.gov>
  9. NNTP-Posting-Host: 148.94.8.235
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.22 (Windows; I; 16bit)
  14.  
  15. sullypj@topo.nist.gov (Paul J Sullivan) wrote:
  16. >I am trying to write a routine (c is not my first language) that will
  17. >allow me to read a binary data file on various platforms. I have
  18. >encountered the -endian problem and, thus, was wondering what routines
  19. >exist to convert between big- and little- formats. Is it possible to
  20. >do this without the conversion i.e. somehow specify a directive?? Is
  21. >it in a FAQ?
  22.  
  23. You probably already thought of it, but just in case...  Different
  24. platforms may have different "boundary alignment" rules.  Reading the
  25. data in as character (byte level alignment) may be needed to prevent
  26. the target platform from skipping over valid data from the source
  27. platform.  Once you have access to the data, then you can swap bytes
  28. to get it in the correct format.
  29.  
  30. Erick
  31.  
  32.